package com.jspgou.cms.dao.impl;

import org.hibernate.Criteria;
import org.springframework.stereotype.Repository;

import com.jspgou.common.hibernate3.Finder;
import com.jspgou.common.hibernate3.HibernateBaseDao;
import com.jspgou.common.page.Pagination;
import com.jspgou.cms.dao.ConsumerTopDao;
import com.jspgou.cms.entity.ConsumerTop;

@Repository
public class ConsumerTopDaoImpl extends HibernateBaseDao<ConsumerTop, Long> implements ConsumerTopDao {
	public Pagination getPage(int pageNo, int pageSize) {
		Criteria crit = createCriteria();
		Pagination page = findByCriteria(crit, pageNo, pageSize);
		return page;
	}

	public ConsumerTop findById(Long id) {
		ConsumerTop entity = get(id);
		return entity;
	}

	public ConsumerTop save(ConsumerTop bean) {
		getSession().save(bean);
		return bean;
	}

	public ConsumerTop deleteById(Long id) {
		ConsumerTop entity = super.get(id);
		if (entity != null) {
			getSession().delete(entity);
		}
		return entity;
	}
	 
	
	@Override
	protected Class<ConsumerTop> getEntityClass() {
		return ConsumerTop.class;
	}
}